//
//  APMPublicDefine.h
//  Q1SDK-APM
//
//  Created by ljwcode on 2022/9/8.
//
#ifndef APMPublicDefine_h
#define APMPublicDefine_h

#pragma mark ------ apm upload -------

#define kAPMLogFileUrl @"kAPMLogFileUrl"

#pragma mark ------ 日志模块分功能tag --------

#define kAPMTAGHTTP @"APMTAGHTTP"

#define kAPMTAGCrash @"APMTAGCrash"

#define kAPMTAGBlock @"APMTAGBlock"

#define kAPMTAGTrackEvent @"APMTAGTrackEvent"

#define kAPMTAGUpload @"kAPMTAGUpload"

#define kAPMTAGKeychain @"kAPMTAGChain"

#define kTAGAPMGeneral @"APMGeneral"

#define kTAGSDKGeneral @"SDKGeneral"

#define GLALog(a) [NSString stringWithFormat:a];

#define Q1LogVerbose(message)  [APMhubLogManager q1_logLever:APMLogLevelVerbose actionLine:__LINE__ function:__func__ stringWithFormat:message]

#define Q1LogDebug(message)  [APMhubLogManager q1_logLever:APMLogLevelDebug actionLine:__LINE__ function:__func__ stringWithFormat:message]

#define Q1LogInfo(message)  [APMhubLogManager q1_logLever:APMLogLevelInfo actionLine:__LINE__ function:__func__ stringWithFormat:message]

#define Q1LogWarning(message)  [APMhubLogManager q1_logLever:APMLogLevelWarning actionLine:__LINE__ function:__func__ stringWithFormat:message]

#define Q1LogError(message)  [APMhubLogManager q1_logLever:APMLogLevelError actionLine:__LINE__ function:__func__ stringWithFormat:message]


//#define Q1LogDebug(message)     [[APMMediator sharedInstance] debug:message line:__LINE__ function:__func__]

#define Q1APMUploadBCLogFileNotification @"Q1APMUploadBCLogFileNotification"

#define Q1APMGetUploadTaskNotification @"Q1APMGetUploadTaskNotification"

#define kAPMCacheCrashCountKey @"kAPMCacheCrashCountKey"

#define kAPMConfigCacheKey @"kAPMConfigCacheKey"

#define kAPM_Params @"kAPM_Params"

#define kAPMBlockCallStack @"blockCallStack"

#define dispatch_main_async_safe(block)\
    if ([NSThread isMainThread]) {\
        block();\
    } else {\
        dispatch_async(dispatch_get_main_queue(), block);\
    }




#pragma mark - dispatch
// 弱引用
#define WeakSelf               __weak typeof(self) weakSelf = self
// 主线程中运行
#define dispatch_async_main(block)   dispatch_async(dispatch_get_main_queue(), block);
// 延时方法的调用
#define dispatch_afterTime(time,block)  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time  * NSEC_PER_SEC)), dispatch_get_main_queue(), block);

#pragma mark ---- key -----

#define kAPMDebugCheckidKey                       @"debugCheckidKey"
#define kAPMDebugConfigureKey                     @"debugConfigureKey"


#define mark ------ report property -----

#define kAPMVersion @"apm_version"

#define kAPMGetConfigSuccess @"APMGetConfigSuccess"

//2024年05月10日09:55:30  测试项目和正式项目APMConfig字段格式不一致，修改字段名为APMConfigure
#define kAPMConfig @"APMConfigure"

#define kAPMGetConfigFail @"APMGetConfigFail"

#define kAPMExt @"ext"

#define kAPMEventBlock @"block"

#define kAPMEventStartCrashMonitor @"startCrashMonitor"

#define kAPMEventCrash @"crash"

#define kAPMEventLog @"log"

#define kAPMUploadType @"uploadType"

#define kAPMFileName @"fileName"

#define kAPMApmUploadSuccess @"apmUploadSuccess"

#define kAPMApmUploadFail @"apmUploadFail"

#define kAPMUploadTask @"apmUploadTask"

#define kAPMTaskConfig @"taskConfig"

#define kAPMEventInitAPM @"initAPM"

#define kAPMLog_detail @"log_detail"

#define kAPMEventBlockStartBlockMonitor @"startBlockMonitor"

#define kAPMEventHttpStart @"HttpStart"

#define kAPMEventHttpEnd @"HttpEnd"

#define kAPMCrashException_type @"exception_type"

#define kAPMCrashException @"exception"

#define kAPMMCrashStack_trace_file @"stack_trace_file"

#define kAPMMCrashStack_trace @"stack_trace"

#define kAPMCrashMem_free @"mem_free"

#define kAPMCrashCpu_free @"cpu_free"

#define kAPMCrashCpu_arc @"cpu_arc"

#define kAPMCrashApm_version @"apm_version"

#define kAPMBlockMem_free @"mem_free"

#define kAPMBlockCpu_free @"cpu_free"

#define kAPMBlockCpu_arc @"cpu_arc"

#define kAPMBlockStack_trace @"stack_trace"

#define kAPMLogURLCacheKey @"logURLCache"

#define kAPMApp_build_id @"app_build_id"

#define kAPMEventTimeFormat @"eventTimeFormat"

#define kAPMCrashCacheKey @"crashCacheKey"

#define kAPMCrashExceptionType @"Exception Type"

#define kAPMCrashExceptionCodes @"Exception Codes"

#define kAPMCrashTerminationReason @"Termination Reason"

#define kAPMCrashCrashDoctorDiagnosis @"CrashDoctor Diagnosis"

#define kAPMLowPowerMode @"LowPowerMode"

#define kAPMConnectType @"netType"

#endif /* APMPublicDefine_h */
